package com.zegome.game.gomestory.main.helper;

import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.utils.BaseDrawable;
import com.zegome.game.gomestory.main.G;

public class TextDrawable extends BaseDrawable{
	
	String[] loading = {"Loading.","Loading..","Loading..."};
	
	float tick;
	float fps = 0.5f;
	int frame;
	
	BitmapFont font;
	
	public TextDrawable(BitmapFont font)
	{
		this.font = font;
	}
	
public void act(float delta)
{
		if(tick>=fps){
			tick = 0;
			frame ++;
			if(frame==loading.length){				
				frame = 0;			
			}
		}
		else{
			tick+=delta;
		}		
}


@Override
public void draw(SpriteBatch batch, float x, float y, float width, float height)
{
	font.draw(batch, loading[frame], x, y);
}
}
